/*
 * barChart.fx
 *
 * Created on 23-dic-2009, 16:03:50
 */

package ProgramSamples.Graphics;

import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.stage.Alert;
import javafx.scene.chart.*;
import javafx.scene.chart.part.*;


def barSeries1: BarChart.Series = BarChart.Series {
    name: "1996"
    data: [
        BarChart.Data { category: "Austria" 	value: 25601.34 action:function(){Alert.inform("Clicked on Austria=25601.34")} },
        BarChart.Data { category: "Brazil" 	value: 20148.82 action:function(){Alert.inform("Clicked on Brazil=20148.82")} },
        BarChart.Data { category: "France" 	value: -10000 action:function(){Alert.inform("Clicked on France=-10000")} },
        BarChart.Data { category: "Italy" 	value: 35407.15 action:function(){Alert.inform("Clicked on Italy=35407.15")} },
        BarChart.Data { category: "USA" 	value: -12000 action:function(){Alert.inform("Clicked on USA=-12000")} }
    ]
}
def barSeries2: BarChart.Series = BarChart.Series {
    name: "1997"
    data: [
        BarChart.Data { category: "Austria" 	value: 57401.85 },
        BarChart.Data { category: "Brazil" 	value: 41941.19 },
        BarChart.Data { category: "France" 	value: 45263.37 },
        BarChart.Data { category: "Italy" 	value: 117320.16 },
        BarChart.Data { category: "USA" 	value: 114845.27 }
    ]
}
def barSeries3: BarChart.Series = BarChart.Series {
    name: "1998"
    data: [
        BarChart.Data { category: "Austria" 	value: 45000.65 },
        BarChart.Data { category: "Brazil" 	value: 44835.76 },
        BarChart.Data { category: "France" 	value: 18722.18 },
        BarChart.Data { category: "Italy" 	value: -17557.31 },
        BarChart.Data { category: "USA" 	value: 92633.68 }
    ]
}

def barChart = BarChart {
    title: "Country Comparison"
    data: [barSeries1, barSeries2, barSeries3]
    categoryAxis: CategoryAxis {
        categories: ["Austria","Brazil","France","Italy","USA"]
    }
    valueAxis: NumberAxis {
        lowerBound: -20000
        upperBound: 120000
        tickUnit: 20000
    }
}

Stage {
    title: "Bar Chart"
    scene: Scene{
	    width: 550
            height: 410
            content: barChart
     } //Scene
}//Stage